#include"Ctrlbase.h"
#include"Ctools.h"
#include<iostream>
using namespace std;
#include<string.h>
Ctrlbase::Ctrlbase()
{
/*	this->x=0;
	this->y=0;
	this->width=10;
	this->width=3;*/
}
Ctrlbase::~Ctrlbase()
{

}
Ctrlbase::Ctrlbase(int x,int y,int width,int height,int ctrlType,char *content)
{
	this->x=x;
	this->y=y;
	this->width=width;
	this->height=height;
	this->ctrlType=ctrlType;
	memset(this->content,0,sizeof(this->content));
	strcpy(this->content,content);
}
void Ctrlbase::show()
{
	switch(this->ctrlType)
	{
	case LABEL:
		CTools::gotoxy(this->x,this->y);
		printf("%s",this->content);
		break;
	case BUTTON:
		CTools::paintWindow(this->x,this->y,this->width,this->height);
		CTools::gotoxy(this->x+2,this->y+1);
		printf("%s",this->content);
		break;
	case EDIT:
		CTools::paintWindow(this->x,this->y,this->width,this->height);
		CTools::gotoxy(this->x+2,this->y+1);
		printf("%s",this->content);
		break;
	}
}
int Ctrlbase:: getctrlType()
{
	return this-> ctrlType;
}
int Ctrlbase::getx()
{
	return x;
}
int Ctrlbase:: gety()
{
	return y;
}
int Ctrlbase:: getwidth()
{
	return width;
}
int Ctrlbase::getheight()
{
	return height;
}
char* Ctrlbase:: getcontent()
{
	return content;
}
void Ctrlbase::setcontent(char *contentValue)
{
	strcpy(this->content,contentValue);
}
void Ctrlbase::KeyListen(char ch)
{
}